<form class="layui-form padding-r20" id="add-rule-group-body">
    <div class="layui-form-item">
        <label class="layui-form-label">名称：</label>
        <div class="layui-input-block">
            <input type="text" model="rule_group_name" required placeholder="请输入规则分组名称" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">简介：</label>
        <div class="layui-input-block">
            <textarea model="rule_group_info"  placeholder="请输入规则分组简介" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" type="button" onclick="addRuleGroup()" id="btn-add-rule-group">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script>
function addRuleGroup(){
    var data = getModel({elem:"#add-rule-group-body"});
    var validate = new Validate();
    var check = validate.check(data,[
        ['rule_group_name','require','规则分组名称'],
        ['rule_group_info','require','规则分组简介']
    ]);
    if(!check){
        msg(validate.getError());
        return false;
    }
    $.post(api.rule_group.add,data,function(res){
        if(res.code){
            reloadTable("rule_group");
        }
        msg(res.msg);
    },'json');
}
</script>